<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>method.jsp</title>
</head>
<body>

<h1>Get 방식과 Post 방식의 차이점</h1>
<form name='frm' action='method.jsp' method='post'>


<fieldset>

<legend>취미로는</legend>
	Name : <input type='text' name='irum' value='Lee'><br/>
	Address : <input type='text' name='address' value='seoul'><p/>
	
	
	[<label><input type='checkbox' name='hobby' value='독서'>독서</label> 
	<label><input type='checkbox' name='hobby' value='낚시'>낚시</label> 
	<label><input type='checkbox' name='hobby' value='등산'>등산</label> 
	<label><input type='checkbox' name='hobby' value='스쿠버'>스쿠버</label>
	<label><input type='checkbox' name='hobby' value='글라이딩'>글라이딩</label> 
	<label><input type='checkbox' name='hobby' value='여행'>여행</label> ]
	을 즐기고 있지요.<p/>

</fieldset>
<p/>

<input type='submit' value='전송'>

</form>
<hr/>
<%

request.setCharacterEncoding("utf-8");//한글이 깨질때 한번만.
if(request.getMethod().equals("POST")){
	out.print("Name : " + request.getParameter("irum"));
	out.print("<br/>");
	out.print("Address : " + request.getParameter("address"));
	
	//체크박스로 넘어온 데이터 처리
	String [] hobby= request.getParameterValues("hobby");
	if(hobby!=null){
		for(int i=0; i<hobby.length; i++){
			out.print("<li>"+hobby[i]);
	}
	}
}

%>
<hr/>
이름:<%=request.getParameter("irum")%><br/>
주소:<%=request.getParameter("address") %>


</body>
</html>